package com.abchina.test;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import com.abchina.test.ZookeeperWrapper;
import java.io.IOException;
import java.util.List;

/**
 * Created by cherry on 15/11/21.
 */
public class Starter {
    public static void main(String[] args) throws IOException, KeeperException, InterruptedException {
//        ZooKeeper scZk = new ZooKeeper("10.233.94.111:2182", 2000, null);
        ZooKeeper scZk = new ZooKeeper("127.0.0.1:2181", 30000, null);

        String dubboPath = "/dubbo";
        ZookeeperWrapper wrapper = new ZookeeperWrapper(scZk);
        List<String> dubboServices = wrapper.getChildren(new ZookeeperWrapper.Path(dubboPath));
        for(String service:dubboServices) {
            System.err.println(service);
        }

        //连接src zk
        //获取/dubbo下的目录
        //在target中遍历,如果不存在就create
        //在target中遍历,如果存在

    }
}
